<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="util.js"></script>
    <script>
        function showInfo(){
            var obj = getFormData("f1");
            alert(JSON.stringify(obj));
        }
    </script>
</head>
<body>
    <form id="f1">
        姓名：<input type="text" name="name"><br>
        电话：<input type="text" name="phone"><br>
        性别：<input type="radio" name="sex" value="男">男
        <input type="radio" name="sex" value="女">女<br>
        学历：<select name="edu">
            <option>高中</option>
        <option>大专</option>
        <option>本科</option>
    </select><br>
        爱好：<input type="checkbox" name="like" value="体育">体育
        <input type="checkbox" name="like" value="音乐">音乐
        <input type="checkbox" name="like" value="美术">美术<br>
        <input type="button" value="提交" onclick="showInfo()">
    </form>
</body>
</html>